﻿#ifndef IMAGESAVEQUEUE_H
#define IMAGESAVEQUEUE_H

#include <QObject>
#include <QMutexLocker>
#include <QWaitCondition>
#include <QThread>
#include <QQueue>
#include <QFile>
#include "framedata.h"

class ImageWriterThread : public QThread {
    Q_OBJECT

public:
    ImageWriterThread(QObject *parent = nullptr);

    void enqueueFrame(const FrameData &frame);

    void stop();

protected:
    void run() override;

private:
    QQueue<FrameData> m_queue;
    QMutex m_mutex;
    QWaitCondition m_notEmpty;
    QWaitCondition m_notFull;
    bool m_stop;
    const int m_maxQueueSize = 1000;  // 最大缓存帧数
};


#endif // IMAGESAVEQUEUE_H
